/**
 * Created by Administrator on 2017/2/12.
 */
import { Component,OnInit } from '@angular/core';
import { DonatwoService } from './dona.serve';
import { Router, ActivatedRoute, Params } from '@angular/router';



@Component({
  moduleId: module.id,
  selector: 'my-donatwo',
  templateUrl: 'donatwo.html',
  providers:[ DonatwoService ]
})
export class DonatwoComponent implements OnInit {
  constructor(private route: ActivatedRoute,
              private router: Router,
              private donatwoService: DonatwoService,) {
  }

  private inf = '';
  private sata='';
  ngOnInit() {
    this.route.params
      .subscribe((params: Params) => {
        this.inf = params['money'];
        console.log(this.inf);
      })
  }
  givecardinfro(firstname:string, lastname:string,email:string,phone:string,zipcode:string,address:string,city:string,state:string,country:string,cardnum:string,cvv2:string,
                month:string,year:string,cardname:string,money:string,type:string){
         this.donatwoService.cardinfro(firstname, lastname,email,phone,zipcode,address,city,state,country,cardnum,cvv2, month,year,cardname,money,type)
           .subscribe(
          res=>{this.sata=res['status'];
          let sa=this.sata;
          console.log(sa);
          console.log(money);
          if (sa=='00'){
            this.router.navigate(['/linkDonathree']);
          }}
         )
  }
}
